﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using Framework.Data.Security;
using Framework.Data.Core;
using Framework.Data.DataManager;
using AppTestWPF.BusinessObjects;
using Oracle.DataBroker;


namespace AppTestWPF
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {

        EntityCollection<object, IBaseEntity> persons;

        public MainWindow()
        {
            InitializeComponent();
            this.LoadData();
            //this.Load();
        }

        private void LoadData()
        {
			DataEntityManager.Instance.DataBroker = new OracleDataBroker(string.Format(OracleDataBroker.DefaultConnectionString,"DEV01","BOIMER01","vbdev03"));
        	if (SecurityManager.Instance.OpenConnection(DataEntityManager.Instance.DataBroker))
            {
        		
                persons = (EntityCollection<object, IBaseEntity>)Personne.GetEntityList(typeof(Personne));

                foreach (Personne p in persons.Values)
                {
                    this.lstPerson.Items.Add(p.Name);
                }
            }
        }
		
		
		private void Load()
		{
		
			Class1.Instance.Cls2 = new Class2("Hello World 2!");
		}
		
		void btnToto_Click(object sender, RoutedEventArgs e)
		{
			MessageBox.Show("Hello World!","Message",MessageBoxButton.OK);
		}
    }
}
